package com.lifeCicle.converters;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;

public class MyConveter implements Converter {
    public MyConveter() {
        super();
    }

    public Object getAsObject(FacesContext facesContext,
                              UIComponent uIComponent, String string) {
       
        if(string.equals("100")){
            throw new ConverterException("Conversion failed.");   
        }
        if(!string.equals("200")){
             string = string + "_pasoConverter_getAsObject";
        }
       
        System.out.println("MyConverter getAsObject: " + string);
        
        return string;
    }

    public String getAsString(FacesContext facesContext,UIComponent uIComponent, Object object) {
        System.out.println("MyConverter getAsString: " + object);
        
      //  String string = (String)object + "_pasoConverter_getAsString";
        return (String)object;
    }
}
